﻿using System.Windows.Controls;
using KinonekoSoftware.Platform.Controls;
using KinonekoSoftware.Studio.Resources.Converters;

namespace KinonekoSoftware.Studio.Pages.Galleries
{

    [Associate(View = typeof(NewInstanceView), ViewModel = typeof(NewInstanceViewModel))]
    public partial class NewInstanceView
    {
        public NewInstanceView()
        {
            InitializeComponent();
        }

        protected override void OnLoaded()
        {
            var vm  = ViewModel<NewInstanceViewModel>();
            var res = Resources["ObjectNameSelector"];

            if (vm is null)
            {
                return;
            }
            
            if (res is ObjectNameSelectorConverter selector)
            {
                selector.Selector = vm.Selector;
            }

            //
            //
            Items.ItemsSource = vm.ExtraTypes;
            
            //
            //
            base.OnLoaded();
        }
    }
}